package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteDeptService;
import com.ruoyi.system.api.domain.SysDept;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;

/**
 * @author nansonghao
 * @description 部门管理服务降级
 * @date 2022/7/13
 */
public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteFileFallbackFactory.class);

    @Override
    public RemoteDeptService create(Throwable throwable) {
        log.error("部门查询服务调用失败:{}", throwable.getMessage());
        return new RemoteDeptService() {
            @Override
            public SysDept getInfoByDeptId(String deptId) {
                return null;
            }
        };
    }
}
